import { useCache } from '@/hooks/web/useCache'
import zhHk from 'element-plus/es/locale/lang/zh-tw'
import en from 'element-plus/es/locale/lang/en'
import zhCn from 'element-plus/es/locale/lang/zh-cn'

const { wsCache } = useCache()

export const elLocaleMap = {
  zh_HK: zhHk,
  en: en,
  zh_CN: zhCn
}
export interface LocaleState {
  currentLocale: LocaleDropdownType
  localeMap: LocaleDropdownType[]
}
//设置默认语言
export const localeModules: LocaleState = {
  currentLocale: {
    lang: wsCache.get('lang') || 'zh_CN',
    elLocale: elLocaleMap[wsCache.get('lang') || 'zh_CN']
  },
  // 多语言
  localeMap: [
    {
      lang: 'zh_CN',
      name: '简体中文'
    },
    {
      lang: 'zh_HK',
      name: '繁體中文'
    },
    {
      lang: 'en',
      name: 'English'
    }
  ]
}
